import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';

class Avatar extends StatelessWidget {
  final String? url;
  final double size;
  const Avatar({Key? key, this.url, this.size = 44}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return PhysicalModel(
      color: Colors.transparent,
      clipBehavior: Clip.antiAlias,
      shape: BoxShape.circle,
      child: url == null
          ? Container(
              width: size,
              height: size,
              color: Colors.grey,
            )
          : CachedNetworkImage(
              imageUrl: url!,
              width: size,
              height: size,
            ),
    );
  }
}
